package com.zlx.mall.basic.web.configuration;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.zlx.mall.basic.web.filter.RequestFilter;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.annotation.Resource;

/**
 * @author qingke
 **/
@Configuration
public class FilterConfiguration {

    @Resource
    private ObjectMapper objectMapper;

    @Bean
    public FilterRegistrationBean<RequestFilter> requestFilter() {
        return new FilterRegistrationBean<>(new RequestFilter(objectMapper));
    }

}
